package apof.util
{
	import apof.model.Transection;
	
	public class Hasher
	{
		public static function hashString(s:String):int {
			if(s==null || s=="null") return 0;
			var h:int=0;
			for(var i:int=0;i<s.length;i++) {
				h+=int(s.charCodeAt(i));
				h*=31;
			}
			return h;
		}
		
		public static function hashTansection(tr:Transection):int {
			var h:int=hashString(tr.name);
			h*=31;
			h+=hashString(tr.description);
			return h;
		}
	}
}